package demo1;
class Student implements Cloneable {
    public int age;
    public String name;

    @Override
    protected Object clone() throws CloneNotSupportedException {
        return super.clone();
    }
}
public class Test {
    public static void main(String[] args) {
            test1();
            test2();
    }
    public static void test1() {
        try {
            throw new CloneNotSupportedException();
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
    }
    public static void test2() {
        Student student = new Student();
        try {
            Student student1 = (Student) student.clone();
            System.out.println("try内部代码被执行了");
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
            System.out.println("CloneNotSupportedException异常被捕获了");
        }
        System.out.println("try-catch后面代码被执行了");
    }
}
